<?php 
$url = $_POST['friend_url'];

$url =  substr($url,strpos($url,'facebook.com') + strlen('facebook.com') );  
$user_name = str_replace(array('/'), array(''), $url);
if(strpos($user_name, "?") > 0 )
$user_name = substr($user_name,0, strpos($user_name, "?")); 

//get the user graph (personal info)
$user_graph = file_get_contents("http://graph.facebook.com/{$user_name}");
echo $user_graph; die; 

